# $Id: PKGBUILD 83750 2013-02-04 22:23:27Z bisson $
# Maintainer: Gaetan Bisson <bisson@archlinux.org>
# Contributor: Kaiting Chen <kaitocracy@gmail.com>
# Contributor: Roberto Alsina <ralsina@kde.org>

pkgname=nsd
pkgver=3.2.15
pkgrel=1
pkgdesc='Authoritative only, high performance and simple DNS server'
url='http://www.nlnetlabs.nl/nsd/'
license=('BSD')
depends=('openssl')
makedepends=('flex')
arch=('i686' 'x86_64')
source=("http://www.nlnetlabs.nl/downloads/${pkgname}/${pkgname}-${pkgver}.tar.gz"
        'service')
sha1sums=('e31a81ab7877422b34e1f163f9509cd93f395664'
          '1cfa2d7254139be50f11753d4e07281ed2af36eb')

install=install

build() {
	cd "${srcdir}/${pkgname}-${pkgver}"

	./configure \
		--prefix=/ \
		--exec-prefix=/usr \
		--datarootdir=/usr/share \
		--with-pidfile=/run/nsd.pid \
		--enable-ratelimit \

	make
}

package() {
	cd "${srcdir}/${pkgname}-${pkgver}"

	make DESTDIR="${pkgdir}" install

	install -d "${pkgdir}"/etc/rc.d
	ln -s ../../usr/sbin/nsdc "${pkgdir}"/etc/rc.d/nsd
	install -Dm644 ../service "${pkgdir}"/usr/lib/systemd/system/nsd.service

	rm doc/differences.pdf
	install -d "${pkgdir}"/usr/share/{doc,licenses}/"${pkgname}"
	install -m644 doc/* "${pkgdir}"/usr/share/doc/"${pkgname}"
	ln -s ../../doc/"${pkgname}"/LICENSE "${pkgdir}"/usr/share/licenses/"${pkgname}"/LICENSE
}
